Cite an article by DOI and the full citation information is gathered automatically. By default this now generates a citation in pandoc-flavored-markdown format. We use the inline command (Abrams, Ruokolainen, Shuter, and McCann, 2012) to create this citation (Abrams et al. 2012).
An in-text citation is generated with citet, such as Boettiger and Hastings (2013) creating the citation to Boettiger and Hastings (2013).
Not all the literature we may wish to cite includes DOIs, such as arXiv preprints, Wikipedia pages, or other academic blogs. Even when a DOI is present it is not always trivial to locate. With version 0.4-0, knitcitations can produce citations given any URL using the Greycite API. For instance, we can use the call (Lord, 2012) to generate the citation to the Greycite tool (???).
We can also use bibentry objects such as R provides for citing packages (using R’s citation() function): (Xie, 2019; Xie, 2015; Xie, 2014) produces (???, ???, Xie 2014). Note that this package includes citations to three objects, and pandoc correctly avoids duplicating the author names. In pandoc mode, we can still use traditional pandoc-markdown citations like (???) which will render as (???) without any R code, provided the citation is already in the .bib file we name (see below).
When the citation is called, a key in the format FirstAuthorsLastName_Year is automatically created for this citation, so we can now continue to cite this article without remembering the DOI, using the command (Abrams, Ruokolainen, Shuter, et al., 2012) creates the citation (Abrams et al. 2012) without mistaking it for a new article.
write.bibtex(file="references.bib")
## Writing 6 Bibtex entries ... OK
## Results written to file 'references.bib'
Abrams, P. A., L. Ruokolainen, B. J. Shuter, and K. S. McCann. 2012. Harvesting creates ecological traps: Consequences of invisible mortality risks in predatorprey metacommunities. Ecology 93:281–293.
Boettiger, C., and A. Hastings. 2013. No early warning signals for stochastic transitions: Insights from large deviation theory. Proceedings of the Royal Society B: Biological Sciences 280:20131372.
Xie, Y. 2014. Knitr: A comprehensive tool for reproducible research in R. in V. Stodden, F. Leisch, and R. D. Peng, editors. Implementing reproducible computational research. Chapman; Hall/CRC.